package com.kyrie.system.druid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/***
 * 描述: 路由数据源切换
 *
 * @author wuxiang
 * @date 2020-04-17 00:24
 */
public class DatasourceSelectHelper {
    static final Logger LOGGER = LoggerFactory.getLogger(DatasourceSelectHelper.class);

    // 数据源类型
    public static final String BUSINESS_DB = "business";

    public static final String CONFIG_DB = "config";

    public static final String ROUTE_DB = "route";

    public static final String REPORT_DB = "report";

    public static final String ARC_DB = "arc";

    private static final ThreadLocal<String> DATASOURCEKEY = new ThreadLocal<String>();

    public static String getKey() {
        return DATASOURCEKEY.get();
    }

    public static void setKey(String key) {
        DATASOURCEKEY.set(key);
        LOGGER.info("datasource dsKey switch to ######{}#####", key);
    }
}
